/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.alxbrendmaquinarias.service;

import com.alxbrendmaquinarias.model.Employee;
import com.alxbrendmaquinarias.repository.GenericDAO;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 *
 * @author Max
 */
@Service
public class EmployeeServiceImpl implements EmployeeService{
    @Autowired
    GenericDAO genericDAO;

    @Override
    public List list(String namedQuery) throws Exception {
        return genericDAO.findWithNamedQuery(namedQuery);
    }

    @Override
    public List list(String namedQuery, Map<String, Object> parameters) throws Exception {
        return genericDAO.findWithNamedQuery(namedQuery, parameters);
    }

    @Override
    public void save(Employee employee) throws Exception {
        genericDAO.create(employee);
    }

    @Override
    public void update(Employee employee) throws Exception {
        genericDAO.update(employee);
    }

    @Override
    public void remove(Employee employee) throws Exception {
        genericDAO.delete(employee);
    }
    
}
